package com.migo3.sso.pojo.generated;

import com.migo3.sso.pojo.User;
import com.speedment.runtime.config.identifier.ColumnIdentifier;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.util.OptionalUtil;
import com.speedment.runtime.field.ComparableField;
import com.speedment.runtime.field.LongField;
import com.speedment.runtime.field.StringField;
import com.speedment.runtime.typemapper.TypeMapper;

import javax.annotation.Generated;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Optional;

/**
 * The generated base for the {@link User}-interface
 * representing entities of the {@code tb_user}-table in the database.
 * <p>
 * This file has been automatically generated by Speedment. Any changes made to
 * it will be overwritten.
 * 
 * @author Speedment
 */
@Generated("Speedment")
public interface GeneratedUser {
    
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getId()} method.
     */
    final LongField<User, Long> ID = LongField.create(
        Identifier.ID,
        User::getId,
        User::setId,
        TypeMapper.primitive(), 
        true
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getUsername()} method.
     */
    final StringField<User, String> USERNAME = StringField.create(
        Identifier.USERNAME,
        User::getUsername,
        User::setUsername,
        TypeMapper.identity(), 
        true
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getPassword()} method.
     */
    final StringField<User, String> PASSWORD = StringField.create(
        Identifier.PASSWORD,
        User::getPassword,
        User::setPassword,
        TypeMapper.identity(), 
        false
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getPhone()} method.
     */
    final StringField<User, String> PHONE = StringField.create(
        Identifier.PHONE,
        o -> OptionalUtil.unwrap(o.getPhone()),
        User::setPhone,
        TypeMapper.identity(), 
        true
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getEmail()} method.
     */
    final StringField<User, String> EMAIL = StringField.create(
        Identifier.EMAIL,
        o -> OptionalUtil.unwrap(o.getEmail()),
        User::setEmail,
        TypeMapper.identity(), 
        true
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getCreated()} method.
     */
    final ComparableField<User, Timestamp, Timestamp> CREATED = ComparableField.create(
        Identifier.CREATED,
        User::getCreated,
        User::setCreated,
        TypeMapper.identity(), 
        false
    );
    /**
     * This Field corresponds to the {@link User} field that can be obtained
     * using the {@link User#getUpdated()} method.
     */
    final ComparableField<User, Timestamp, Timestamp> UPDATED = ComparableField.create(
        Identifier.UPDATED,
        User::getUpdated,
        User::setUpdated,
        TypeMapper.identity(), 
        false
    );
    
    /**
     * Returns the id of this User. The id field corresponds to the database
     * column db0.migo2.tb_user.id.
     * 
     * @return the id of this User
     */
    long getId();
    
    /**
     * Returns the username of this User. The username field corresponds to the
     * database column db0.migo2.tb_user.username.
     * 
     * @return the username of this User
     */
    String getUsername();
    
    /**
     * Returns the password of this User. The password field corresponds to the
     * database column db0.migo2.tb_user.password.
     * 
     * @return the password of this User
     */
    String getPassword();
    
    /**
     * Returns the phone of this User. The phone field corresponds to the
     * database column db0.migo2.tb_user.phone.
     * 
     * @return the phone of this User
     */
    Optional<String> getPhone();
    
    /**
     * Returns the email of this User. The email field corresponds to the
     * database column db0.migo2.tb_user.email.
     * 
     * @return the email of this User
     */
    Optional<String> getEmail();
    
    /**
     * Returns the created of this User. The created field corresponds to the
     * database column db0.migo2.tb_user.created.
     * 
     * @return the created of this User
     */
    Timestamp getCreated();
    
    /**
     * Returns the updated of this User. The updated field corresponds to the
     * database column db0.migo2.tb_user.updated.
     * 
     * @return the updated of this User
     */
    Timestamp getUpdated();
    
    /**
     * Sets the id of this User. The id field corresponds to the database column
     * db0.migo2.tb_user.id.
     * 
     * @param id to set of this User
     * @return   this User instance
     */
    User setId(long id);
    
    /**
     * Sets the username of this User. The username field corresponds to the
     * database column db0.migo2.tb_user.username.
     * 
     * @param username to set of this User
     * @return         this User instance
     */
    User setUsername(String username);
    
    /**
     * Sets the password of this User. The password field corresponds to the
     * database column db0.migo2.tb_user.password.
     * 
     * @param password to set of this User
     * @return         this User instance
     */
    User setPassword(String password);
    
    /**
     * Sets the phone of this User. The phone field corresponds to the database
     * column db0.migo2.tb_user.phone.
     * 
     * @param phone to set of this User
     * @return      this User instance
     */
    User setPhone(String phone);
    
    /**
     * Sets the email of this User. The email field corresponds to the database
     * column db0.migo2.tb_user.email.
     * 
     * @param email to set of this User
     * @return      this User instance
     */
    User setEmail(String email);
    
    /**
     * Sets the created of this User. The created field corresponds to the
     * database column db0.migo2.tb_user.created.
     * 
     * @param created to set of this User
     * @return        this User instance
     */
    User setCreated(Date created);
    
    /**
     * Sets the updated of this User. The updated field corresponds to the
     * database column db0.migo2.tb_user.updated.
     * 
     * @param updated to set of this User
     * @return        this User instance
     */
    User setUpdated(Date updated);
    
    enum Identifier implements ColumnIdentifier<User> {
        
        ID ("id"),
        USERNAME ("username"),
        PASSWORD ("password"),
        PHONE ("phone"),
        EMAIL ("email"),
        CREATED ("created"),
        UPDATED ("updated");
        
        private final String columnName;
        private final TableIdentifier<User> tableIdentifier;
        
        Identifier(String columnName) {
            this.columnName = columnName;
            this.tableIdentifier = TableIdentifier.of(getDbmsName(), getSchemaName(), getTableName());
        }
        
        @Override
        public String getDbmsName() {
            return "db0";
        }
        
        @Override
        public String getSchemaName() {
            return "migo2";
        }
        
        @Override
        public String getTableName() {
            return "tb_user";
        }
        
        @Override
        public String getColumnName() {
            return this.columnName;
        }
        
        @Override
        public TableIdentifier<User> asTableIdentifier() {
            return this.tableIdentifier;
        }
    }
}